package com.goldsprite.gameframeworks.assets;
import com.goldsprite.gameframeworks.utils.math.*;
import com.badlogic.gdx.graphics.*;

public enum GameRes {
	//主相机视图
	MainCameraView(),
	//UI
	Boss_Sample("sprites/blocks/boss_sample.png"),
	Btn_Up("sprites/ui/btn_up.png", new int[]{4, 4, 4, 4}),
	Btn_Down("sprites/ui/btn_down.png", new int[]{4, 4, 4, 4}),

	//GameUI_Skin

	//背景
	Background_Jungle("sprites/backs/jungle/jungle_sheet.png"),
	Background_PCity("sprites/backs/pcity/pcity_sheet.png"),
	Background_MountainPlains("sprites/backs/mountainPlains/mountainPlains_sheet.png", 512, 521),
	Background_Forest("sprites/backs/forest/Forest_Sheet.png", 3800, 2400),
	Clouds("sprites/blocks/clouds/Clouds-Sheet.png", 227, 147),
	StartTitle("sprites/ui/start-menu/title.png", 2048, 2048),

	//实体
	Frost("sprites/entities/frost/Frost-Sheet.png", 390, 184, 8, 30),
	Golem("sprites/entities/golem/Golem-Sheet.png", 90, 64, 25, 30),
	BlackCanine("sprites/entities/black_canine/Canine_Black-Sheet.png", 48, 32, 24, 18),
	DemonRat("sprites/entities/demon_rat/demon_rat-Sheet.png", 32, 32, 18, 12),

	//方块
	Frost_Idle("sprites/entities/frost/frost_idle.png"),
	Frost_Attack("sprites/entities/frost/frost_attack.png"),
	SpawnPoint("sprites/blocks/icon_location.png", 128, 128),
	Grass0("sprites/blocks/grass0.png"),
	Grass("sprites/blocks/grass.png"),
	Ground("sprites/blocks/ground.png"),
	Glow("sprites/blocks/glow.png"),
	Monster_Door("sprites/blocks/monster_door.png"),
	Camp1("sprites/blocks/tent_1.png"),
	Block_Fire("sprites/blocks/fire.png"),
	Block_MonsterPortal("sprites/blocks/portal_sheet.png"),

	//九宫格
	NinePatch_Grass("sprites/grass.png", new int[]{16, 16, 32, 16}),

	//物品

	//音频
	BGM_Thema("audios/bgm/thema.m4a", GameResType.Music),

	//颜色
	Black(GameResType.Color),
	White(GameResType.Color),
	Blue(GameResType.Color),
	Orange(GameResType.Color),
	Gray(GameResType.Color);

	private String path = "";
	private GameResType type = GameResType.Texture;
	private int[] ninePatchEdge = null;//左右上下
	private int[] uvUnit;
	public Vector2Int bodySize = new Vector2Int();
	public Vector2 footCenter = new Vector2();


	GameRes() {
	}

	GameRes(String path) {
		this.path = path;
	}
	GameRes(GameResType type){
		this.type = type;
	}
	GameRes(String path, GameResType type){
		this.path = path;
		this.type = type;
	}
	GameRes(String path, int[] ninePatchEdge){//左右上下
		this.path = path;
		this.ninePatchEdge = ninePatchEdge;
	}

	GameRes(String texPath, int uvUnitX, int uvUnitY, int bodySizeX, int bodySizeY) {
		this(texPath, uvUnitX, uvUnitY);
		bodySize.set(bodySizeX, bodySizeY);
	}
	GameRes(String texPath, int uvUnitX, int uvUnitY) {
		this.path = texPath;
		this.uvUnit = new int[2];
		this.uvUnit[0] = uvUnitX;
		this.uvUnit[1] = uvUnitY;
	}

	public String getPath() {
		return path;
	}

	public GameResType getType() {
		return type;
	}
	public void setType(GameResType type) {
		this.type = type;
	}

	public <T> T getResource() {
		return GameAssetManager.getInstance().getResource(this);
	}
	public <T> T getResource(Class<T> type) {
		return type.cast((Texture)getResource());
	}

	public int[] getNinePatchEdge() {
		return ninePatchEdge;
	}
	public int[] getUVUnit() {
		if(uvUnit == null){
			uvUnit = new int[2];
			Texture tex = getResource(Texture.class);
			uvUnit[0] = tex.getWidth();
			uvUnit[1] = tex.getHeight();
		}
		return uvUnit;
	}

	public enum GameResType {
		Color, Texture, Music, NinePatch
	}
}
